import QtQuick 2.12
import QtQuick.Window 2.12

Window {
    visible: true
    width: 200
    height: 100
    title: qsTr("Button")

    Rectangle{
        width: 100
        height: 46
        anchors.centerIn: parent

        Image{
            anchors.centerIn: parent

            property bool checked: false

            source: checked ? "img/btn_on.png" : "img/btn_off.png"

            MouseArea{
                id: ma
                anchors.fill: parent
                onClicked: {
                    parent.checked = !parent.checked
                    if(parent.checked)
                        console.log("true")
                    else
                        console.log("false")
                }
            }
        }
    }
}
